/*
* SIP XML Scenario Maker

* Copyright 2008 Rachid El Khayari

*

* This file is part of SIP XML Scenario Maker (SXSM).

*

* SXSM is free software: you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation, either version 3 of the License, or

* (at your option) any later version.

*

* SXSM is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with SXSM.  If not, see <http://www.gnu.org/licenses/>.

*/
#ifndef SXSM_H
#define SXSM_H

//include inherited class QWidget
#include <QWidget>

/*!
* Because used Qt classes are not needed in the interface of this class and only in the implementation,
* forward declaration of the classes in the header file is used
* and the header files are included in the .cpp file, which speeds up compilation.
*/
class QLineEdit;
class QGridLayout;
class QLabel;
class QPushButton;
class QComboBox;
class QGroupBox;
class QTextEdit;
class QProcess;
class QStringList;
class QListWidget;


/*!
 * SXSM Main class: This class implements the central widget of the application.
 * As it is a widget, QWidget class is inherited.
 */
class sxsm : public QWidget
{
//this macro does the whole Qt magic
  Q_OBJECT

public:
/*!
 * \brief The constructor of the sxsm class
 * is executed when sxsm Widget is created.
 */
  sxsm();

private slots:
/*!
 * \brief This slot deletes the scenario file, that currently is selected
 * in the scenario list.
 */
	void deleteScenario();
/*!
 * \brief This slot saves the content of the scenario to a new scenario file
 * with the specified file name.
 */
	void saveScenario();
/*!
 * \brief This slot shows the content of the selected scenario file.
 */
	void viewScenario();
/*!
 * \brief This slot loads the entries of the scenario list.
 */
	void loadScenarios();
/*!
 * \brief This slot loads the entries of the message type list.
 */
	void loadMessageTypeList();
/*!
 * \brief This slot loads the entries of the message list.
 */
	void loadMessageList();
/*!
 * \brief This slot deletes entries of the message list.
 */
	void deleteMessage();
/*!
 * \brief This slot adds the selected message to the message list.
 */
	void addMessage();
/*!
 * \brief This slot creates a new xml scenario in scenario viewer.
 */
	void makeScenario();
/*!
 * \brief This slot creates a new scenario set.
 */
	void makeSet();

	void makeNameDialog();



//private member functions
private:
/*!
 * \brief Creates a new scenario set with the specified name.
 */
	bool createSet(QString dirname);
/*!
 * \brief Loads the entries of the scenario set list
 * from the scenariosets.dat file in scenario set directory.
 */
	bool loadScenarioSetList();
/*!
 * \brief Loads the entries of the scenario list
 * from the scenarios.dat file in scenario directory.
 */
	bool loadScenarioList();
/*!
 * \brief Writes changes permanently to the scenario list
 * by adding an entry to the scenarios.dat in scenario directory.
 */
	bool writeScenarioList();
/*!
 * \brief Loads and displays the currently selected scenario file.
 */
	bool loadScenarioDetail(QString scenarioName);
/*!
 * \brief Writes changes to the currently displayed scenario file permanently.
 */
	bool writeScenarioDetail(QString scenarioName);
/*!
 * \brief Loads entries from messageset.dat into the message set list.
 */
	bool makeMessageSetCombo();
/*!
 * \brief Loads entries from the messagetype.dat into message type list.
 */
	bool makeMessageTypeCombo();
/*!
 * \brief Loads entries from message.dat into message list.
 */
	bool makeMessageCombo();
/*!
 * \brief Loads message content from message file and appends it to the scenario file.
 */
	bool makeMessage();
/*!
 * \brief Displays Dialog for scenario set creation.
 * with the specified file name.
 */

	void makeCreateDialog();

	QString DataDir;
	QString MessageDir;
	QString ScenarioDir;
	QString SIPpPath;
	QString CSVDir;
	QString LogDir;

	QGridLayout *scenarioLayout;
	QGridLayout *scenarioDetailLayout;
	QGridLayout *scenarioMessageDetailLayout;
	QGridLayout *scenarioGlobalParametersLayout;

	QGroupBox *createScenarioMakerGroupBox();
	QGroupBox *createScenarioViewerGroupBox();

	QDialog *createDialog;
	QDialog *scenarioNameDialog;
	QLineEdit *newMessageSetLine;
	QPushButton *newMessageSetButton;
	QComboBox *scenarioSet;
	QComboBox *scenarioNames;
	QPushButton *scenarioDeleteButton;
	QPushButton *scenarioSaveButton;
	QPushButton *newMessageButton;
	QPushButton *scenarioMakeButton;
	//QLineEdit *scenarioNewName;
	//QLabel *scenarioNewNameLabel;
	QComboBox *scenarioMessageSet;
	QComboBox *scenarioMessageType;
	QComboBox *scenarioMessage;
	QPushButton *addMessageButton;
	QListWidget *scenarioListWidget;
	QPushButton *scenarioElementDeleteButton;
	QTextEdit *scenarioMessageDetailText;
};

#endif //SXSM_H
/*
* SIP XML Scenario Maker
* Copyright 2008 Rachid El Khayari
*
* This file is part of SIP XML Scenario Maker (SXSM).
*
* SXSM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SXSM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SXSM.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SXSM_H
#define SXSM_H

//include inherited class QWidget
#include <QWidget>

/*!
* Because used Qt classes are not needed in the interface of this class and only in the implementation,
* forward declaration of the classes in the header file is used
* and the header files are included in the .cpp file, which speeds up compilation.
*/
class QLineEdit;
class QGridLayout;
class QLabel;
class QPushButton;
class QComboBox;
class QGroupBox;
class QTextEdit;
class QProcess;
class QStringList;
class QListWidget;


/*!
 * SXSM Main class: This class implements the central widget of the application.
 * As it is a widget, QWidget class is inherited.
 */
class sxsm : public QWidget
{
//this macro does the whole Qt magic
  Q_OBJECT

public:
/*!
 * \brief The constructor of the sxsm class
 * is executed when sxsm Widget is created.
 */
  sxsm();

private slots:
/*!
 * \brief This slot deletes the scenario file, that currently is selected
 * in the scenario list.
 */
	void deleteScenario();
/*!
 * \brief This slot saves the content of the scenario to a new scenario file
 * with the specified file name.
 */
	void saveScenario();
/*!
 * \brief This slot shows the content of the selected scenario file.
 */
	void viewScenario();
/*!
 * \brief This slot loads the entries of the scenario list.
 */
	void loadScenarios();
/*!
 * \brief This slot loads the entries of the message type list.
 */
	void loadMessageTypeList();
/*!
 * \brief This slot loads the entries of the message list.
 */
	void loadMessageList();
/*!
 * \brief This slot deletes entries of the message list.
 */
	void deleteMessage();
/*!
 * \brief This slot adds the selected message to the message list.
 */
	void addMessage();
/*!
 * \brief This slot creates a new xml scenario in scenario viewer.
 */
	void makeScenario();
/*!
 * \brief This slot creates a new scenario set.
 */
	void makeSet();

//private member functions
private:
/*!
 * \brief Creates a new scenario set with the specified name.
 */
	bool createSet(QString dirname);
/*!
 * \brief Loads the entries of the scenario set list
 * from the scenariosets.dat file in scenario set directory.
 */
	bool loadScenarioSetList();
/*!
 * \brief Loads the entries of the scenario list
 * from the scenarios.dat file in scenario directory.
 */
	bool loadScenarioList();
/*!
 * \brief Writes changes permanently to the scenario list
 * by adding an entry to the scenarios.dat in scenario directory.
 */
	bool writeScenarioList();
/*!
 * \brief Loads and displays the currently selected scenario file.
 */
	bool loadScenarioDetail(QString scenarioName);
/*!
 * \brief Writes changes to the currently displayed scenario file permanently.
 */
	bool writeScenarioDetail(QString scenarioName);
/*!
 * \brief Loads entries from messageset.dat into the message set list.
 */
	bool makeMessageSetCombo();
/*!
 * \brief Loads entries from the messagetype.dat into message type list.
 */
	bool makeMessageTypeCombo();
/*!
 * \brief Loads entries from message.dat into message list.
 */
	bool makeMessageCombo();
/*!
 * \brief Loads message content from message file and appends it to the scenario file.
 */
	bool makeMessage();
/*!
 * \brief Displays Dialog for scenario set creation.
 * with the specified file name.
 */
	void makeCreateDialog();

	QString DataDir;
	QString MessageDir;
	QString ScenarioDir;
	QString SIPpPath;
	QString CSVDir;
	QString LogDir;

	QGridLayout *scenarioLayout;
	QGridLayout *scenarioDetailLayout;
	QGridLayout *scenarioMessageDetailLayout;
	QGridLayout *scenarioGlobalParametersLayout;

	QGroupBox *createScenarioMakerGroupBox();
	QGroupBox *createScenarioViewerGroupBox();

	QDialog *createDialog;
	QLineEdit *newMessageSetLine;
	QPushButton *newMessageSetButton;
	QComboBox *scenarioSet;
	QComboBox *scenarioNames;
	QPushButton *scenarioDeleteButton;
	QPushButton *scenarioSaveButton;
	QPushButton *newMessageButton;
	QPushButton *scenarioMakeButton;
	QLineEdit *scenarioNewName;
	QLabel *scenarioNewNameLabel;
	QComboBox *scenarioMessageSet;
	QComboBox *scenarioMessageType;
	QComboBox *scenarioMessage;
	QPushButton *addMessageButton;
	QListWidget *scenarioListWidget;
	QPushButton *scenarioElementDeleteButton;
	QTextEdit *scenarioMessageDetailText;
};

#endif //SXSM_H
